<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Person(name,age){
            this.name = name,
            this.age = age
        }
        Person.prototype.sayName = function(){
            console.log(this.name);
        }
        function Teacher(name,age,skill){
            Person.call(this,name,age),
            this.skill = skill
        }
        // 继承
        Teacher.prototype = Person.prototype;
        // Teacher.prototype.constructor = Teacher;
        
        Teacher.prototype.sayAge = function(){
            console.log(this.age);
        }
        
        var t  = new Teacher("zhang",18,"js");
        t.sayName()
        t.sayAge()
        console.log('t: ', t);
        // console.log('t: ', t.sayAge());
        var p  = new Person("lisi",18);
        // console.log('p: ', p);
        </script>
</body>
</html>